<template>
  <div class="cateBox">
    <!-- 面包屑 -->
    <el-bared></el-bared>
    <!-- 添加按钮 -->
    <el-button @click="add" class="addBtn" type="success">添加</el-button>
    <!-- 列表展示 -->
    <v-list @edit="edit"></v-list>
    <!-- 弹框展示 -->
    <v-dialog ref='dialog' @offCheck="offCheck" :isShow="isShow" :isAdd="isAdd"></v-dialog>
  </div>
</template>

<script>
//引入子组件
import vList from "./list.vue";
import vDialog from "./dialog.vue";
export default {
  data() {
    return {
      isShow: false,
      isAdd: true,
    };
  },
  components: {
    vList,
    vDialog,
  },
  methods: {
    //点击添加
    add() {
      this.isShow = true;
      this.isAdd = true;
    },
    //点击取消
    offCheck(e) {
      this.isShow = e;
    },
    //点击编辑
    edit(id) {
      this.isShow = true;
      this.isAdd = false;
      // 调用子组件的数据回显方法
      this.$refs.dialog.getOneSeck(id)
    },
  },
};
</script>

<style scoped lang="less">
.cateBox {
  .addBtn {
    margin-top: 30px;
    margin-bottom: 5px;
  }
}
</style>
